package b6.vacancyshare;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import android.app.Activity;
import android.os.Bundle;

public class Coba extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
    
    public void retrieveData() throws ClassNotFoundException, SQLException{
    	Class.forName("org.postgresql.Driver");
    	String url;
    	url = "jdbc:postgresql://pghost:5432/pgdatabase" + "?sslfactory=org.postgresql.ssl.NonValidatingFactory" +
    	  "&ssl=true";
    	Connection conn = DriverManager.getConnection(url,"postgres","muhartini");
        conn.close();
        
        String sql;
        sql = "SELECT relname FROM pg_class WHERE relkind = 'r';";
        
        Statement st = conn.createStatement();
        ResultSet rs = st.executeQuery(sql); 
        
        while (rs.next()){
        	String relname = rs.getString("relname");
        }
        rs.close();
        st.close();
    }
    
}